<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:58:"E:\www\sunwm\web/../application/admin\view\city\index.html";i:1508290804;s:61:"E:\www\sunwm\web/../application/admin\view\public\header.html";i:1503189484;s:61:"E:\www\sunwm\web/../application/admin\view\public\footer.html";i:1512624954;}*/ ?>
﻿<!DOCTYPE html>
<html lang="zh-cn">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="renderer" content="webkit">
		<title><?php echo config('sitename'); ?>-<?php echo lang('label')['Login_title']; ?></title>
		<link rel="stylesheet" type="text/css" href="__ROOT__/static/public/css/pintuer.css" />
		<link rel="stylesheet" type="text/css" href="__ROOT__/static/admin/css/admin.css" />
		<script type="text/javascript" src="__ROOT__/static/public/js/jquery.js"></script>
		<script type="text/javascript" src="__ROOT__/static/public/js/pintuer.js"></script>
		<script type="text/javascript" src="__ROOT__/static/admin/js/admin.js"></script>
		<script type="text/javascript" src="__ROOT__/static/public/layer/layer.js"></script>
		<script type="text/javascript" src="__ROOT__/static/public/laydate/laydate.js"></script>
		<script type="text/javascript" src="__ROOT__/static/public/laytpl/laytpl.js"></script>
	</head>

	<body>
	<style>
		html { overflow-x:hidden; }
	</style>
<div class="panel admin-panel">
	<table class="table table-hover">
		<tr>
			<th width="200"><?php echo lang('currency')['province']; ?></th>
			<th width="200"><?php echo lang('currency')['city']; ?></th>
			<th width="200"><?php echo lang('currency')['area']; ?></th>
			<th width="200">City ID</th>
			<th width="100"><?php echo lang('label')['status']; ?></th>
			<?php if(session('type') == 'all'): ?>
			<th width="400"><?php echo lang('label')['handle']; ?></th>
			<?php endif; ?>
		</tr>
		<?php if(is_array($data) || $data instanceof \think\Collection || $data instanceof \think\Paginator): $i = 0; $__LIST__ = $data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$list): $mod = ($i % 2 );++$i;?>
		<tr class="province" data-id="<?php echo $list['id']; ?>" type="city">
			<td style="line-height:20px"><?php echo $list['name']; ?></td>
			<td style="line-height:20px">---</td>
			<td style="line-height:20px">---</td>
			<td style="line-height:20px"><?php echo $list['id']; ?></td>
			<td style="line-height:20px"><?php if($list['status'] == "1"): ?><span class="icon-check text-sub"><?php echo lang('currency')['status_1']; ?></span><?php else: ?><span class="icon-times text-dot"><?php echo lang('currency')['status_2']; ?></span><?php endif; ?></td>
			<?php if(session('type') == 'all'): ?>
			<td style="line-height:20px"><a class="button border-blue button-little" href="city/status.html?type=province&id=<?php echo $list['id']; ?>&status=1" onclick="event.stopPropagation();"><?php echo lang('currency')['status_1']; ?></a> <a class="button border-yellow button-little" href="city/status.html?type=province&id=<?php echo $list['id']; ?>&status=2" onclick="event.stopPropagation();"><?php echo lang('currency')['status_2']; ?></a></td>
			<?php endif; ?>
		</tr>
		<?php endforeach; endif; else: echo "" ;endif; ?>
	</table>
</div>
<script>
$('#select_del').click(function(){
	var str="";
	$("input:checkbox[name=id]:checked").each(function(){
		str+=$(this).val()+",";
	});
	if(str!=''){
		if(confirm('<?php echo lang('currency')['del']; ?>?')){location.href='city/del.html?id='+str;}
	}
});
$('.province').click(function(){
	var type = $(this).attr('type');
	var id = $(this).attr('data-id');
	if($(this).is('.open') == false){
		$.getJSON('/web/admin/city/ajax_get?type='+type+'&id='+id, {}, function(res){
			var tpl = $("#"+type+"_list_tpl").html(); //读取模版
			//方式一：异步渲染（推荐）
			laytpl(tpl).render(res, function(render){
				//$(this).after(render);
				$("[data-id="+id+"]").after(render);
			});
		});
		$(this).addClass('open');
	}else{
		$('[father_id='+id+']').each(function(){
			$('[father_id='+$(this).attr('data-id')+']').remove();
		});
		$('[father_id='+id+']').remove();
		$(this).removeClass('open');
	}
});
function city(obj){
	var type = $(obj).attr('type');
	var id = $(obj).attr('data-id');
	if($(obj).is('.open') == false){
		$.getJSON('/web/admin/city/ajax_get?type='+type+'&id='+id, {}, function(res){
			var tpl = $("#"+type+"_list_tpl").html(); //读取模版
			//方式一：异步渲染（推荐）
			laytpl(tpl).render(res, function(render){
				//$(this).after(render);
				$("[data-id="+id+"]").after(render);
			});
		});
		$(obj).addClass('open');
	}else{
		$('[father_id='+id+']').remove();
		$(obj).removeClass('open');
	}
}
</script>
<script id="city_list_tpl" type="text/html">
	{{# for(var i = 0, len = d.data.length; i < len; i++){ }}
	<tr onclick="city(this)" father_id="{{ d.data[i].father_id }}" data-id="{{ d.data[i].id }}" type="area">
		<td style="line-height:20px">--- ></td>
		<td style="line-height:20px">{{ d.data[i].name }}</td>
		<td style="line-height:20px"></td>
		<td style="line-height:20px">{{ d.data[i].id }}</td>
		<td style="line-height:20px">{{# if(d.data[i].status=='1'){ }}<span class="icon-check text-sub"><?php echo lang('currency')['status_1']; ?></span>{{# }else{ }}<span class="icon-times text-dot"><?php echo lang('currency')['status_2']; ?></span>{{# } }}</td>
		<?php if(session('type') == 'all'): ?>
		<td style="line-height:20px">
			<a href="__URL__/status.html?type=city&id={{ d.data[i].id }}&status=1"><button class="button border-blue button-little"><?php echo lang('currency')['status_1']; ?></button></a> <a href="__URL__/status.html?type=city&id={{ d.data[i].id }}&status=2"><button class="button border-yellow button-little"><?php echo lang('currency')['status_2']; ?></button></a>
		</td>
		<?php endif; ?>
	</tr>
	{{# } }}
</script>
<script id="area_list_tpl" type="text/html">
	{{# for(var i = 0, len = d.data.length; i < len; i++){ }}
	<tr father_id="{{ d.data[i].father_id }}" data-id="{{ d.data[i].id }}" type="">
		<td style="line-height:20px">--- ></td>
		<td style="line-height:20px">--- ></td>
		<td style="line-height:20px">{{ d.data[i].name }}</td>
		<td style="line-height:20px">{{ d.data[i].id }}</td>
		<td style="line-height:20px">{{# if(d.data[i].status=='1'){ }}<span class="icon-check text-sub"><?php echo lang('currency')['status_1']; ?></span>{{# }else{ }}<span class="icon-times text-dot"><?php echo lang('currency')['status_2']; ?></span>{{# } }}</td>
		<?php if(session('type') == 'all'): ?>
		<td style="line-height:20px">
			<a href="__URL__/status.html?type=area&id={{ d.data[i].id }}&status=1"><button class="button border-blue button-little"><?php echo lang('currency')['status_1']; ?></button></a> <a href="__URL__/status.html?type=area&id={{ d.data[i].id }}&status=2"><button class="button border-yellow button-little"><?php echo lang('currency')['status_2']; ?></button></a>
		</td>
		<?php endif; ?>
	</tr>
	{{# } }}
</script>
<p class="text-center text-gray" style="margin-top:10px;"><a class="text-gray" target="_blank" href="http://www.wm0530.com">完美外卖系统 Power by 网络工厂</a></p>
</body>
<script>
$('.upload').on('click',function (){
		var id = $(this).attr('data-id');
		 upload(id);
	}
);
function upload(id){
	layer.open({
		type:2,
		title:false,
		area: ['70%', '90%'],
		offset: '5%',
		content: "<?php echo url('/admin/material'); ?>?id="+id
	});
}
</script>
</html>